import request from '@/utils/request'

export const getQueryCourses = data => {
  return request({
    methods: 'POST',
    url: '/boss/course/getQueryCourses',
    data
  })
}

export const changeStage = params => {
  return request({
    methos: 'GET',
    url: '/boss/course/changeStage',
    params
  })
}

// 保存或者更改课程信息
export const saveOrUpdateCourse = data => {
  return request({
    method: 'POST',
    url: '/boss/course/saveOrUpdateCourse',
    data
  })
}

// 上传图片（添加配置项与参数）
export const uploadCourseImage = (data, onUploadProgress) => {
  return request({
    method: 'POST',
    url: '/boss/course/upload',
    data,
    // Axios 将 HTML5 新增的上传进度事件：progress
    onUploadProgress
  })
}

// 通过课程Id获取课程信息
export const getCourseById = courseId => {
  return request({
    method: 'GET',
    url: '/boss/course/getCourseById',
    params: {
      courseId
    }
  })
}
